package cn.enilu.guns.bean.entity.system;

import cn.enilu.guns.bean.entity.BaseEntity;
import cn.enilu.guns.bean.entity.door.EntranceGuardRule;
import lombok.Data;
import org.hibernate.annotations.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * Created  on 2018/4/2 0002.
 *
 * @author enilu
 */
@Entity(name = "t_sys_user")
@Table(appliesTo = "t_sys_user",comment = "系统管理员")
@Data
@EntityListeners(AuditingEntityListener.class)
public class User  extends BaseEntity {


//    @ManyToMany(mappedBy = "users")
//    private Set<EntranceGuardRule> entranceGuardRules = new HashSet<>();

    @Column
    private String avatar;
    @Column
    private String account;
    @Column
    private String password;
    @Column
    private String salt;
    @Column
    private String name;
    @Column
    private Date birthday;
    @Column
    private Integer sex;
    @Column
    private String email;
    @Column
    private String phone;
    @Column
    private String roleid;
//    @Column
//    private Long deptid;
    @Column
    private Integer status;
    @Column
    private Integer version;
    @Column(name="credentials_type")
    private String credentialsType;
    @Column(name="credentials_no")
    private String credentialsNo;
    @Column
    private String position;
    @Column(name="Entry_Date")
    private Date entryDate;
    @Column(name="serial_number")
    private String serialNumber;
    @Column(name="is_own_card")
    private String isOwnCard;
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name="deptid",referencedColumnName = "id",columnDefinition = "BIGINT(19) COMMENT '部門id'")
    private Dept deptInfo;

}
